#include <TimerOne.h>

#include <Keyboard.h>

const int KEYIN = 2;
const int mouseButton = 3;

const long ONE_SECOND = 100000;

int in = 0;

int wing_freq = 0;
enum FLY_STATUS {
  KEEP = 0,
  UP = 1,
  DOWN = 2,
  LEFT = 3,
  RIGHT = 4,
  ROT_LEFT,
  ROT_RIGHT
  };

void setup() {
  // put your setup code here, to run once:
  Serial.begin(9600);
  //pinMode(mouseButton, INPUT);
  pinMode(KEYIN, INPUT);

  // initialize keyboard control
  // Mouse.begin();
  Timer1.initialize(ONE_SECOND);
  Timer1.attachInterrupt(kb_control); 
  Keyboard.begin();
}

void loop() {
  // put your main code here, to run repeatedly:
  in = digitalRead(KEYIN);
  if (in == HIGH)
  {
    Serial.println("High");
    Keyboard.write(KEY_LEFT_ARROW);
  } else if (in == LOW)
  {
    Serial.println("Low");
    Keyboard.write(KEY_RIGHT_ARROW);
  } else {
    Serial.println("Others");
  }
//  while(digitalRead(KEYIN));
}

void kb_control() {
  
  
}
